﻿/*
 * 文件名称：
 * 程序员：huangsb
 * 创建时间：2008/05/10
 * 
 * 功能说明：访问统计
 * 
 * 修改人员：
 * 
 * 修改日期：
 * 
 * 修改记录：
 */

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Whir_System_Module_AccessStat_StatList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();

        if (!IsPostBack)
        {
            BindData();
        }
    }

    //绑定
    protected void BindData()
    {
        DataSet ds = Whir.SQLServerDAL.DbHelperSQL.GetList("Whir_AccessStat", "createDate", "*", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex - 1, "", "", "createDate desc");
        int count = int.Parse(ds.Tables[1].Rows[0][0].ToString());
        AspNetPager1.RecordCount = count;
        if (count > 0)
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }

    protected string getUrl(string str)
    {
        if (str == "直接访问")
            return str;
        else
            return "<a href='" + str + "' target='_blank'>" + Whir.Common.WebHelper.StringHelper.CutString(str, 30) + "</a>";
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindData();
    }

    //删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int[] cbs = this.GridView1.CheckedIndexs;

        if (cbs.Length == 0)
        {
            Whir.Common.WebHelper.JsHelper.Alert(Page, "请选择记录!");
            return;
        }

        Whir.BLL.Whir_AccessStat bll = new Whir.BLL.Whir_AccessStat();
        foreach (int cb in cbs)
        {
            bll.Delete(cb);
        }

        BindData();

        Whir.Common.WebHelper.JsHelper.Alert(Page, "删除成功!");
    }
}
